unit uAppUI;

interface

uses
  Classes, Graphics, Controls, StdCtrls, ExtCtrls, jpeg, GIFImg, ActnMenus;

procedure LoadMainFormBanner(container: TPanel);
procedure CustomizeMenu(MenuBar: TActionMainMenuBar);

implementation

{$r banner.res}

procedure LoadJPEGFromResName(Picture: TPicture; const ResName: string);
var
  jpegimg: TJPEGImage;
  res: TStream;
begin
  jpegimg := TJPEGImage.Create;
  try
    res := TResourceStream.Create(HInstance, ResName, 'JPEG');
    try
      jpegimg.LoadFromStream(res);
      Picture.Graphic := jpegimg;
    finally
      res.Free;
    end;
  finally
    jpegimg.Free;
  end;
end;

procedure LoadGIFFromResName(Picture: TPicture; const ResName: string);
var
  gifimg: TGIFImage;
  res: TStream;
begin
  gifimg := TGIFImage.Create;
  try
    res := TResourceStream.Create(HInstance, ResName, 'GIF');
    try
      gifimg.LoadFromStream(res);
      Picture.Graphic := gifimg;
    finally
      res.Free;
    end;
  finally
    gifimg.Free;
  end;
end;

procedure LoadMainFormBanner(container: TPanel);
var
  img: TImage;
begin
  container.Height := 70;

  img := TImage.Create(container);
  img.AutoSize := True;
  LoadJPEGFromResName(img.Picture, 'banner1');
  img.Visible := True;
  img.Parent := container;
  img.Align := alLeft;

  img := TImage.Create(container);
  img.AutoSize := False;
  img.Stretch := True;
  LoadJPEGFromResName(img.Picture, 'banner2');
  img.Visible := True;
  img.Parent := container;
  img.Align := alClient;
end;

procedure CustomizeMenu(MenuBar: TActionMainMenuBar);
var
  i: Integer;
begin
  for i := 2 to 5 do
    MenuBar.ActionClient.Items[i].Visible := False;
end;

end.
